
<CFQUERY NAME="getUSERFILTERIDs" DATASOURCE="#client.company_dsn#">
	SELECT USERFILTERID, ISDEFAULT, USERFILTERTYPE FROM ECRGUSERFILTER
	WHERE FORMCODE = 'powerWSUser'
		AND USERFILTERID='#client.chapa#'
</CFQUERY>
<CFSET sBuffFilter = "">
<CFSET sBuffFilterAll = "">
<CFIF getUSERFILTERIDs.recordCount GT 0>
	<CFLOOP QUERY = "getUSERFILTERIDs">
		<!---{{{ Filter will use specific filter --->
			<!---{{{ USERDEFINED--->
		<CFQUERY NAME="qryCRGUSERFILTERCONDITION" DATASOURCE="#client.company_dsn#">
			SELECT PRIORITYNO, ALIAS, SOURCEFIELD, OPERATOR, VALUEORALIAS,
					JOININGFIELD, JOININGOPERATOR, GROUPSTART, GROUPEND, '0' AS CONDITION_TAG
			FROM ECRGUSERFILTERCONDITION
			WHERE USERFILTERID = '#getUSERFILTERIDs.USERFILTERID#'
			ORDER BY USERFILTERID, PRIORITYNO <!--- Please don't change order by,
				changing the order by will result to a logical error in program --->
		</CFQUERY>
		<CFSET perUserExist = true>
		<CFSET passed = true>
		<CFINCLUDE TEMPLATE="userfilterfunc_genfilter2.cfm">
		<!---}}}--->
	</CFLOOP>
	<!---}}}--->
</CFIF>
<CFQUERY NAME="QUERYVIEW" DATASOURCE="#client.company_dsn#">
	SELECT
		PERSONNELIDNO, LASTNAME, FIRSTNAME, MIDDLENAME,EMPLOYMENTSTATUS
	FROM CMFPA
	WHERE  EMPLOYMENTSTATUS <> 'SEPARATED'
	<CFIF sBuffFilterAll NEQ "">
		 AND #PRESERVESINGLEQUOTES(sBuffFilterAll)#
	</CFIF>
	<CFIF IsDefined("Form.edtValFilter") AND #Form.edtValFilter# NEQ "">
		AND #Form.cmbSort# LIKE '%#Form.edtValFilter#%'
	</CFIF>
	<CFIF IsDefined("form.cmbSort")>
		ORDER BY #form.cmbSort# <CFIF IsDefined("form.ascdesc")>#form.ascdesc#</CFIF>
	</CFIF>

</CFQUERY>

<CFSET checkList = "">
<CFIF not isDefined("CLIENT.edtDateFrom")>
	<CFSET CLIENT.edtDateFrom=FORM.edtDateFrom>
	<CFSET CLIENT.edtDateTo=FORM.edtDateTo>
</CFIF>
<CFSET lstAddtnlButton="btnAddEmp~Add~Add,btnBackAdd~Back~Back">
<CFSET lstOrder="Personnel Id No~PERSONNELIDNO~ftString,Last Name~LASTNAME~ftString,First Name~FIRSTNAME~ftString,Middle Name~MIDDLENAME~ftString,Section~SECTIONCODE~ftString,Position~POSITIONCODE~ftString,Employment Status~EMPLOYMENTSTATUS~ftString">
<CFSET frmname="frmAddEmps">
<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="Select Employees">
<CFOUTPUT>
	<CFSET act = URLEncodedFormat(encrypt("addemployees",client.ek))>
	
	<FORM ACTION="index.cfm?recordview=&id=#url.id#" METHOD="POST" NAME="frmAddEmps" onSubmit="javascript: check()">
	<INPUT TYPE="Hidden" NAME="hidCheckList" value="#checkList#">
	<INPUT TYPE="Hidden" NAME="hidCheck" value="">
	<INPUT TYPE="Hidden" NAME="hidUnCheck" value="">
	<INPUT TYPE="Hidden" NAME="hidviewrec" value="">

	<CFINCLUDE template="#client.common_path#/toolbar.cfm">
	<CFIF isDefined("form.refresh")>
		<CFSET checkList = "">
		<CFSET nStartrow = 1>
	</CFIF>
</CFOUTPUT>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH="100%">
	<CFOUTPUT>
		<TR BGCOLOR="#client.color_tblhead#">
			<TD HEIGHT=18></TD>
			<TD CLASS="boldwhite">Personnel ID No.</TD>
			<TD CLASS="boldwhite">Last Name</TD>
			<TD CLASS="boldwhite">First Name</TD>
			<TD CLASS="boldwhite">Middle Name</TD>
			<TD CLASS="boldwhite">Employment Status</TD>
		</TR>
	</CFOUTPUT>
	<CFIF QueryView.recordcount GT 0>
		<CFOUTPUT QUERY="QueryView" STARTROW="#nStartrow#" MAXROWS="#Evaluate(nEndrow - nStartrow + 1)#">
		<TR BGCOLOR="#IIf(CurrentRow Mod 2, "client.color_tblset2", "client.color_tblset1")#" VALIGN="top">
			<TD>
				<INPUT TYPE="checkbox" NAME="chkPERSONNELIDNO" VALUE="#PERSONNELIDNO#~#FIRSTNAME#&nbsp;#LASTNAME#" <CFIF listFind(checkList, PERSONNELIDNO) NEQ 0>CHECKED</CFIF>>
			</TD>
			<TD>#PERSONNELIDNO#</TD>
			<TD>#LASTNAME#</TD>
			<TD>#FIRSTNAME#</TD>
			<TD>#MIDDLENAME#</TD>
			<TD>#EMPLOYMENTSTATUS#</TD>
		</TR>
		</CFOUTPUT>
	<CFELSE>
		<tr><td class="bold" WIDTH=250>No records found in the current filter.</td></tr>
	</CFIF>
	<CFOUTPUT>
		<TR BGCOLOR="#client.color_tblfoot#">
			<TD COLSPAN=8	CLASS="boldwhite" HEIGHT=18>Records: #nStartrow# - #nEndRow# of #QueryView.RecordCount#</TD>
		</TR>
	</CFOUTPUT>
</TABLE>
</FORM>
<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
